<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>nestedap</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="nchnls_i.html" title="nchnls_i" />
    <link rel="next" href="nlfilt.html" title="nlfilt" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">nestedap</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="nchnls_i.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="nlfilt.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="nestedap"></a>
      <div class="titlepage"></div>
      <a id="IndexNestedap" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">nestedap</span>
        </h2>
        <p>nestedap — 
      Three different nested all-pass filters.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp127103216"></a>
        <h2>Description</h2>
        <p>
      Three different nested all-pass filters, useful for implementing reverbs.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127167904"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>nestedap</strong></span> asig, imode, imaxdel, idel1, igain1 [, idel2] [, igain2] \
      [, idel3] [, igain3] [, istor]</pre>
      </div>
      <div class="refsect1">
        <a id="idp127170288"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>imode</em></span> -- operating mode of the filter:
      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>1 = simple all-pass filter</p>
            </li>
            <li class="listitem">
              <p>2 = single nested all-pass filter</p>
            </li>
            <li class="listitem">
              <p>3 = double nested all-pass filter</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>idel1</em></span>, <span class="emphasis"><em>idel2</em></span>, <span class="emphasis"><em>idel3</em></span> -- delay times of the filter stages. Delay times are in seconds and must be greater than zero. <span class="emphasis"><em>idel1</em></span> must be greater than the sum of <span class="emphasis"><em>idel2</em></span> and <span class="emphasis"><em>idel3</em></span>. 
    </p>
        <p>
      <span class="emphasis"><em>igain1</em></span>, <span class="emphasis"><em>igain2</em></span>, <span class="emphasis"><em>igain3</em></span> -- gain of the filter stages.
    </p>
        <p>
      <span class="emphasis"><em>imaxdel</em></span> -- will be necessary if k-rate delays are implemented. Not currently used.
    </p>
        <p>
      <span class="emphasis"><em>istor</em></span> -- Skip initialization if non-zero (default: 0).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127181760"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig</em></span> -- input signal
    </p>
        <p>
      If <span class="emphasis"><em>imode</em></span> = 1, the filter takes the form:
      </p>
        <div class="mediaobject">
          <img src="images/imode1.png" alt="Picture of nestedap imode 1 filter." />
          <div class="caption">
            <p>Picture of imode 1 filter.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      If <span class="emphasis"><em>imode</em></span> = 2, the filter takes the form:
      </p>
        <div class="mediaobject">
          <img src="images/imode2.png" alt="Picture of nestedap imode 2 filter." />
          <div class="caption">
            <p>Picture of imode 2 filter.</p>
          </div>
        </div>
        <p>
    </p>
        <p>
      If <span class="emphasis"><em>imode</em></span> = 3, the filter takes the form:
      </p>
        <div class="mediaobject">
          <img src="images/imode3.png" alt="Picture of nestedap imode 3 filter." />
          <div class="caption">
            <p>Picture of imode 3 filter.</p>
          </div>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127196032"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the nestedap opcode. It uses the file <a class="ulink" href="examples/nestedap.csd" target="_top"><em class="citetitle">nestedap.csd</em></a>, and <a class="ulink" href="examples/beats.wav" target="_top"><em class="citetitle">beats.wav</em></a>.
      </p>
        <div class="example">
          <a id="idp127198656"></a>
          <p class="title">
            <strong>Example 537. Example of the nestedap opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o nestedap.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="oblock">instr</span> 5
  insnd     <span class="op">=</span>           p4
  gasig     <span class="opc">diskin2</span>     insnd, 1
<span class="oblock">endin</span>

<span class="oblock">instr</span> 10
  imax      <span class="op">=</span>           1
  idel1     <span class="op">=</span>           p4<span class="op">/</span>1000
  igain1    <span class="op">=</span>           p5
  idel2     <span class="op">=</span>           p6<span class="op">/</span>1000
  igain2    <span class="op">=</span>           p7
  idel3     <span class="op">=</span>           p8<span class="op">/</span>1000
  igain3    <span class="op">=</span>           p9
  idel4     <span class="op">=</span>           p10<span class="op">/</span>1000
  igain4    <span class="op">=</span>           p11
  idel5     <span class="op">=</span>           p12<span class="op">/</span>1000
  igain5    <span class="op">=</span>           p13
  idel6     <span class="op">=</span>           p14<span class="op">/</span>1000
  igain6    <span class="op">=</span>           p15

  afdbk     <span class="opc">init</span> 0

  aout1     <span class="opc">nestedap</span> gasig<span class="op">+</span>afdbk<span class="op">*</span>.4, 3, imax, idel1, igain1, idel2, igain2, idel3, igain3
  
  aout2     <span class="opc">nestedap</span> aout1, 2, imax, idel4, igain4, idel5, igain5

  aout      <span class="opc">nestedap</span> aout2, 1, imax, idel6, igain6

  afdbk     <span class="opc">butterlp</span> aout, 1000

            <span class="opc">outs</span> gasig<span class="op">+</span>(aout<span class="op">+</span>aout1)<span class="op">/</span>2, gasig<span class="op">-</span>(aout<span class="op">+</span>aout1)<span class="op">/</span>2
  
gasig     <span class="op">=</span>           0
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">f</span>1 0 8192 10 1

<span class="comment">; Diskin</span>
<span class="comment">;   Sta  Dur  Soundin</span>
<span class="stamnt">i</span>5  0    3    "beats.wav"

<span class="comment">; Reverb</span>
<span class="comment">;   St  Dur  Del1 Gn1  Del2  Gn2  Del3  Gn3  Del4  Gn4  Del5  Gn5  Del6  Gn6</span>
<span class="stamnt">i</span>10 0   4    97   .11  23   .07   43   .09   72    .2   53    .2   119   .3
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp127202944"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Hans Mikelson</td>
          </tr>
          <tr>
            <td>February 1999</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.53</p>
        <p>The example was updated May 2002, thanks to Hans Mikelson</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="nchnls_i.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="nlfilt.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">nchnls_i </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> nlfilt</td>
        </tr>
      </table>
    </div>
  </body>
</html>
